<?php defined('IN_IA') or exit('Access Denied');?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
    <title><?php  echo $active['title'];?></title>
    <link rel="stylesheet" href="<?php echo WEB_RESOURCE;?>/mobile/theme/public.min.css?v=2019030101">
    <link rel="stylesheet" href="<?php echo WEB_RESOURCE;?>/mobile/theme/black/css/foxui.min.css?v=2019030101">
    <link rel="stylesheet" href="<?php echo WEB_RESOURCE;?>/mobile/theme/black/css/style.css?v=2019030101">
    <link rel="stylesheet" href="<?php echo WEB_RESOURCE;?>/mobile/theme/black/css/home1.css?v=2019030101">
    <style>
        .danmu {display: none;opacity: 0;}
        .Home_detail .activc{width: 100% !important;}
        .beforeIndex{position: fixed;}
        .register .agreement{display:block;position:absolute;width:70%;margin:12px auto;top:60%;left:50%;transform:translateX(-42%);font-size:12px}
        .register input[type="checkbox"]{display:none;}
        .register input[type="checkbox"] + .agreement-input{display:inline-block;position:relative;width:14px;height:14px;border:1px solid #ccc;border-radius:2px;vertical-align:sub;}
        .register input[type="checkbox"]:checked + .agreement-input::after{content:' ';display:block;position:absolute;top:-2px;left:1px;width:12px;height:6px;border-left:4px solid #191919;border-bottom:4px solid #191919;transform-origin:center;transform:rotate(-45deg);}
        .Home_tan_as>div:nth-child(1){top:31%}
        .Home_tan_as>div:nth-child(2){top:45%}
    </style>
</head>

<body>
    <!--首页-->
    <!--头部音频-->
    <div class="Home_video">
        <!--点击log播放音频-->
        <div>
            <?php  if(empty($order) && !empty($active['music'])) { ?>
            <audio id="Jaudio" class="media-audio" src="<?php  echo tomedia($active['music']);?>" loop="true"></audio>
            <?php  } else if(!empty($active['music_order'])) { ?>
            <audio id="Jaudio" class="media-audio" src="<?php  echo tomedia($active['music_order']);?>" loop="true"></audio>
            <?php  } ?>
            <div class="music_control btn-ani">
                <img class="play_btn" src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/cncir1.png">
            </div>
        </div>
        <!--获得奖励弹幕-->
        <div style="overflow: hidden">
            <div class="swiper-container container2 swiper-container-vertical swiper-container-ios"
                style="height: 100px">
                <div class="swiper-wrapper">
                    <div class="swiper-container container2 swiper-container-vertical swiper-container-ios"
                        id="swiper3" style="height: 80px">
                        <div class="swiper-wrapper" id="logs">
                            <?php  if(is_array($buys)) { foreach($buys as $buy) { ?>
                            <div class="swiper-slide container2_slide">
                                <div>
                                    <p class="name_imgr">
                                        <img src="<?php  echo tomedia($buy['avatar']);?>">
                                        <span>恭喜<?php  echo $buy['nickname'];?>购买成功</span>
                                    </p>
                                </div>
                            </div>
                            <?php  } } ?>
                        </div>
                        <span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span>
                    </div>
                </div>
                <span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span>
            </div>
        </div>

    </div>
    <?php  if(empty($myMchId)) { ?>
    <!--商家加盟log-->
    <div class="Home_sj">
        <a href="<?php  echo web2app_url('main', ['et'=>'join','pid'=>$active['id']])?>">
            <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/jiameng.png"></a>
    </div>
    <?php  } ?>
    <div class="Home_gr">
        <a href="<?php  echo web2app_url('personalCenter', ['et'=>'index', 'pid'=>$active['id']])?>">
            <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/geren.png">
        </a>
    </div>
    <?php  if(!empty($myMchId)) { ?>
    <div class="Home_gr" style="bottom:36%">
        <a href="<?php  echo web2app_url('mchCenter', ['et'=>'mchCenter', 'pid'=>$active['id']])?>">
            <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/mch_logo_black.png">
        </a>
    </div>
    <?php  } ?>
    <div class="Home_dh">
        <a href="tel:<?php  echo $active['tel'];?>">
            <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/dianhua.png"></a>
    </div>
    <!--下半部分-->
    <div class="Home_buttom">
        <!--分享好友得红包-->
        <img src="<?php  echo tomedia($active['cover']);?>" style="width:100%">

        <!--联盟商家-->
        <div class="Home_union">
            <div class="Home_union_a">
                <p>联盟商家</p>
                <p>(排名不分先后)</p>
                <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_left.png">
                <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_right.png">
                <!--联盟商家头像log-->
                <div class="Home_union_tylog">
                    <div class="swiper-container" id="swiper1">
                        <div class="swiper-wrapper swiper1" id="merchant">
                            <?php  if(is_array($mchs)) { foreach($mchs as $mch) { ?>
                            <a href="<?php  echo $mch['mch_link'];?>" class="swiper-slide">
                                <img src="<?php  echo tomedia($mch['avatar']);?>">
                                <span><?php  echo $mch['mch_name'];?></span>
                            </a>
                            <?php  } } ?>
                        </div>
                        <!-- Add Pagination -->
                        <!-- <div class="swiper-pagination"></div> -->
                    </div>
                </div>
                <!--点击商家头像查看详情信息-->
                <p class="Home_dj">点击商家头像查看详情信息</p>
                <!--左右滑动查看更多商家-->
                <div class="Home_huadong">
                    <div>
                        <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/cncir9.png"></div>
                    <div>
                        <p>左右滑动查看更多商家</p>
                    </div>
                    <div>
                        <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/created.png"></div>
                </div>
                <!--我要加盟-->
                <div class="Home_jiameng">
                    <a href="<?php  echo web2app_url('main', ['et'=>'join','pid'=>$active['id']])?>">
                        <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/iwant.png"></a>
                </div>
            </div>
        </div>
        <!--距离活动结束还有-->
        <div class="Home_end">
            <!--log-->
            <p>距离活动结束还有</p>
            <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_left.png">
            <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_right.png">
            <p class="Home_end_ntto">
                <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/bg4.png"></p>
            <!--活动倒计时-->
            <div class="Home_countdown">
                <!--天-->
                <div class="Home_countdown_a">
                    <p id="RemainD2">0</p>
                    <p id="RemainD1">0</p>
                    <p id="RemainD">0</p>
                </div>
                <div class="text">天</div>
                <div class="Home_countdown_a">
                    <p id="RemainH1">0</p>
                    <p id="RemainH">0</p>
                </div>
                <div class="text">时</div>
                <div class="Home_countdown_a">
                    <p id="RemainM1">0</p>
                    <p id="RemainM">0</p>
                </div>
                <div class="text">分</div>
                <div class="Home_countdown_a">
                    <p id="RemainS1">0</p>
                    <p id="RemainS">0</p>
                </div>
                <div class="text">秒</div>
            </div>
        </div>
        <?php  if($active['open_recommend'] == 'on') { ?>
        <!-- 推荐好友拼单 -->
        <div class="Home_pin">
            <?php  $avg = round(($active['recommend_reward_min'] + $active['recommend_reward_max']) / 2, 2);?>
            <div class="Home_pin_a">
                <p>推荐好友拼单</p>
                <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_left2.png">
                <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_right2.png">
                <div class="cardbox">
                    <div class="cardbox_left">
                        <span>￥</span><?php  echo $avg;?>
                        <!-- <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/pic1.png"> -->
                    </div>
                    <ul class="cardbox_right">
                        <li>每推荐一位好友拼单成功， 立即获得<?php  echo $avg;?>元现金红包</li>
                        <li>人人可参与，先到先得！</li>
                    </ul>
                </div>
                <div class="people">已有 <?php  echo $active['views'];?> 人参加活动</div>
            </div>
        </div>
        <?php  } ?>
        <!--优惠详情-->
        <div class="Home_preferential">
            <!--详情log-->
            <div class="Home_preferential_log">推荐商家信息
                <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_left3.png">
                <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_right3.png"></div>
            <div class="Home_detail" style="display: block;">
                <div class="Home_detail_a">
                    <div class="swiper-container" id="swiper2">
                        <div class="swiper-wrapper" id="coupons">
                            <?php  if(is_array($mchs)) { foreach($mchs as $mch) { ?>
                            <div class="swiper-slide activc">
                                <div class="Home_detail_a_log">
                                    <div class="Home_detail_a_loga">
                                        <div>
                                            <a href="<?php  echo $mch['mch_link'];?>">
                                                <img src="<?php  echo tomedia($mch['avatar']);?>" style="width: 3rem;height: 3rem;border-radius: 50%;">
                                            </a>
                                        </div>
                                    </div>
                                    <div class="Home_detail_a_logb">
                                        <p>
                                            <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/pic2.png">
                                            <span><?php  echo $mch['mch_name'];?></span>
                                        </p>
                                        <p>
                                            <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/pic3.png">
                                            <span><?php  echo $mch['mobile'];?></span>
                                        </p>
                                        <p>
                                            <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/pic4.png">
                                            <span><?php  echo $mch['address'];?></span>
                                        </p>
                                    </div>
                                </div>
                                <div class="fengexianbox">
                                    <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/pic5.png" class="fengexian">
                                </div>
                                <div class="Home_detail_a_tupian">
                                    <div class="numbox">代金券</div>
                                    <?php  if(empty($mch['getted'])) { ?>
                                    <a href="javascript:;" class="take" data-ticket-id="<?php  echo $mch['ticket_id'];?>">点击领取</a>
                                    <?php  } else { ?>
                                    <a href="javascript:;" class="taked">已领取</a>
                                    <?php  } ?>
                                    <div class="text"><?php  echo $mch['mch_name'];?><br>
                                        <span>赠送价值<?php  echo $mch['amount'];?>元大礼包</span>
                                    </div>
                                </div>
                            </div>
                            <?php  } } ?>

                        </div>
                    </div>
                </div>
            </div>
            <div class="Home_huadong">
                <div>
                    <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/cncir9.png"></div>
                <div>
                    <p>左右滑动查看更多商家</p>
                </div>
                <div>
                    <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/created.png"></div>
            </div>
        </div>
        <!--领红包排行榜-->
        <div class="Home_hongbao">
            <!--领红包排行榜log-->
            <div class="Home_preferential_log">领红包排行榜
                <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_left3.png">
                <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_right3.png"></div>
            <!--排行榜-->
            <div class="Home_hongbao_a">
                <div class="">
                    <div class=" Home_hongbao_as_top">
                        <!--排名图片-->
                        <div>排名</div>
                        <!--头像 ID-->
                        <div>
                            <span>用户</span></div>
                        <div>
                            <p>红包金额</p>
                        </div>
                    </div>
                    <div id="bonus">
                        <?php  if(is_array($reds)) { foreach($reds as $index => $red) { ?>
                        <div class="Home_hongbao_as">
                            <div><?php  echo $index+1?></div>
                            <div><?php  echo $red['nickname'];?></div>
                            <div><?php  echo $red['get_reward'];?>元</div>
                        </div>
                        <?php  } } ?>
                        <?php  if(empty($red)) { ?>
                        <p class="text-center" style="line-height:100px">暂无记录</p>
                        <?php  } ?>
                    </div>
                </div>
            </div>
        </div>
        <!--休闲专区-->
        <div class="Home_foods Home_foods1">
            <!--详情log-->
            <div class="Home_foods_log">卡券列表
                <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_left3.png">
                <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_right3.png"></div>
            <div class="Home_foodsdetail" id="coupon2">
                <?php  if(is_array($tickets)) { foreach($tickets as $ticket) { ?>
                    <?php  if(empty($ticket['getted'])) { ?>
                    <div class="cardbox" style="margin: 0 auto 10px;">
                    <?php  } else { ?>
                    <div class="cardbox cardboxed" style="margin: 0 auto 10px;">
                    <?php  } ?>
                        <div class="num"><?php  echo $ticket['mch_name'];?></div>
                        <div class="yellowtext">总价值：<?php  echo $ticket['amount'];?>元</div>
                        <div class="text">
                            <?php  if($ticket['time_type'] == 'endtime') { ?>
                            使用期至: <span><?php  echo date('Y-m-d', $ticket['end_time'])?></span>
                            <?php  } else if($ticket['time_type'] == 'endtime_period') { ?>
                            领取后<span><?php  echo $ticket['endtime_period'];?></span> 天内有效
                            <?php  } ?>
                        </div>
                        <?php  if(empty($ticket['getted'])) { ?>
                        <a href="javascript:;" class="take" data-ticket-id="<?php  echo $ticket['ticket_id'];?>">点击领取</a>
                        <?php  } ?>
                        <a href="<?php  echo $ticket['mch_link'];?>" class="goods">
                            <img src="<?php  echo tomedia($ticket['avatar']);?>">
                        </a>
                    </div>
                <?php  } } ?>
            </div>
        </div>
        <!--活动规则-->
        <div class="Home_hdgz">
            <p class="Home_gz">活动规则</p>
            <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_left.png">
            <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/top_right.png">
            <p class="Home_end_ntto">
                <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/bg4.png"></p>
            <!--规则-->
            <div class="Home_hdgz_a">
                <?php  echo $active['rules'];?>
            </div>
        </div>
        <!--footer-->
        <?php  echo $active['support_name'];?>

        <!--分享挣钱 立即抢购-->
        <div class="Hoem_share">
            <!--分享挣钱-->
            <div>
                <a href="<?php  echo web2app_url('main', ['et'=>'showPosters', 'src'=>$posters, 'title'=>$active['title'], 'type'=>'black'])?>">
                    <p>分享挣钱</p>
                </a>
            </div>
            <!--立即抢购-->
            <!-- <div class="qianggou">
                    <p>立即抢购</p>
                </div> -->
            <?php  if(!empty($order) && $order['status'] == 'pay_done' && !empty($active['pay_done_btn_name'])) { ?>
            <div><p class="a_btn"><?php  echo $active['pay_done_btn_name'];?></p></div>
            <?php  } ?>
            <?php  if(empty($order) || $order['status'] == 'wait_pay') { ?>
            <div class="qianggou">
                <p><?php  echo $active['price'];?>元立即抢购</p>
            </div>
            <?php  } ?>
        </div>
    </div>

    <?php  if($order['status'] != 'pay_done') { ?>
    <!--弹框-->
    <div class="Home_tan" style="display: none;">
        <form class="register" method="POST" id="form" action="<?php  echo web2app_url('main', ['et'=>'createOrder'])?>">
            <input type="hidden" name="active_id" value="<?php  echo $active['id'];?>">
            <input type="hidden" name="order_sn" value="<?php  echo $order['order_sn'];?>">
            <input type="hidden" name="oid" value="<?php  echo $_GPC['oid'];?>">
            <input type="hidden" name="oi" value="<?php  echo $_GPC['oi'];?>">
            <img class="shanchua" src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/shanchu.png">
            <div class="Home_tan_a">
                <div class="Home_tan_as">
                    <!--请输入姓名-->
                    <div class="Home_name">
                        <div>
                            <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/name.png">
                        </div>
                        <!--姓名输入框-->
                        <div>
                            <input type="text" name="name" placeholder="请输入姓名" id="username" value="<?php  echo $order['name'];?>">
                        </div>
                    </div>
                    <!--请输入手机号-->
                    <div class="Home_name">
                        <div>
                            <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/mobile.png">
                        </div>
                        <!--姓名输入框-->
                        <div>
                            <input type="text" name="mobile" placeholder="请输入手机号" id="mobile" value="<?php  echo $order['mobile'];?>">
                        </div>
                    </div>
                    <label class="agreement">
                        <input type="checkbox" id="agreement" checked class="agreement-input">
                        <span class="agreement-input"></span>&emsp;我已认真阅读并同意活动规则
                    </label>
                    <!--提交-->
                    <button type="submit" class="Home_tijiao"></button>
                </div>
            </div>
        </form>
    </div>
    <?php  } ?>

    <!-- 支付成功 -->
    <div class="success">
        <img class="success_img" src="<?php  echo tomedia($active['pay_done_cover']);?>" alt="" <?php  if(!empty($active['pay_done_link'])) { ?> onclick=" location.href='<?php  echo $active['pay_done_link'];?>' " <?php  } ?>>
        <img class="success_close" src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/close.png" alt="">
    </div>
    <!-- 支付成功 -->

    <script src="<?php echo WEB_RESOURCE;?>/lib/require.min.js"></script>
    <script src="./resource/js/lib/mui.min.js?v=20181228"></script>
    <script>
        require.config({
            baseUrl: '.',
            paths: {
                'jquery': '<?php echo WEB_RESOURCE;?>/lib/jquery/jquery.min',
                'marque': '<?php echo WEB_RESOURCE;?>/mobile/js/marque',
                'tool': '<?php echo WEB_RESOURCE;?>/mobile/js/tool',
                'ft-carousel': '<?php echo WEB_RESOURCE;?>/mobile/js/ft-carousel',
                'swiper': '<?php echo WEB_RESOURCE;?>/lib/swiper/swiper.min',
                'util': 'resource/js/app/util',
                'barrager': '<?php echo WEB_RESOURCE;?>/lib/jquery/barrager/jquery.barrager.min'
            },
            map: {'*': {'css': '<?php echo WEB_RESOURCE;?>/lib/css.min.js'}},
            shim: {
                'tool': {deps: ['jquery']},
                'ft-carousel': {deps: ['jquery']},
                'util': {deps:['jquery']},
                'swiper': {deps: ['jquery', 'css!<?php echo WEB_RESOURCE;?>/lib/swiper/swiper.min']},
                'barrager': {deps: ['jquery', 'css!<?php echo WEB_RESOURCE;?>/lib/jquery/barrager/barrager.min']}
            },
            proiority: ['jquery']
        });
    </script>
    <!-- 启屏页 -->
    <script>
    // require(['jquery'], function($) {
    //     $('.Home_detail').hide();
    //     setTimeout(function () {
    //         $('.beforeIndex').fadeOut();
    //         $('.Home_detail').show();
    //     },3000)
    // })
    </script>
    <script>
        // 分享
        <?php echo js_share($active["share_text"], $active["share_desc"], $domainurl, !empty($active['share_image']) ? tomedia($active['share_image']) : '', ["pid"=>$active["id"], "oid"=>$_GPC["oid"]])?>

        require(['jquery', 'util'], function($, util) {
            $(window).on('load', function() {
                var ls = window.localStorage.getItem('pay');
                if(typeof ls == 'string') {
                    try {
                        ls = JSON.parse(ls);
                    
                        // 支付中监听、10分钟以内的订单
                        if(ls.result == 'wait' && ls.time + 600 > '<?php  echo TIMESTAMP?>') {
                            <?php  if(!empty($active['pay_done_cover']) && $order['status'] == 'pay_done') { ?>
                                ls.result = 'success';
                                ls.time = '<?php  echo TIMESTAMP?>';
                                ls.sn = '<?php  echo $order["order_sn"];?>';
                                window.localStorage.setItem('pay', JSON.stringify(ls));
                                
                                $('.success').show();
                            <?php  } ?>//
                        }
                    } catch (error) {
                        ls = {};
                    }
                }

            });
            $('.success_close').on('click', function() {
                $('.success').hide();
            })
            $('#form').on('submit', function () {
                if(!$('#agreement').prop('checked')) {
                    alert("请同意活动规则后报名");
                    return false;
                }
                $.post($(this).prop('action'), $(this).serialize()).then(function(res) {
                    if(typeof res == 'string') {
                        res = JSON.parse(res);
                        if(typeof res.url != 'undefined') {
                            alert('请授权您的微信基本信息后再报名');
                            location.href = res.url;
                        }
                    } else {
                        if(res.errno != 0) {
                            alert(res.message);
                            return false;
                        }
                        var data = res.data;
                        var ls = {
                            sn: data.order_sn,
                            result: 'wait',
                            time: data.time
                        };
                        window.localStorage.setItem('pay', JSON.stringify(ls));
                        if(data.servername != data.pay_url && data.pay_url != '') {
                            location.href = data.payment;
                        } else {
                            util.pay({
                                orderFee: data.price,
                                payMethod: 'wechat',
                                orderTitle: "<?php  echo $active['title'];?>",
                                orderTid: data.order_sn,
                                module: '<?php  echo MNAME?>',
                                success: function() {
                                    location.reload();
                                },
                                fail: function(e) {
                                    alert('报名失败，请稍后重试');
                                },
                                complete: function(e) {
                                    // alert('报名完成');
                                }
                            });
                        }
                    }

                })
                return false;
            });
        });

        // 倒计时
        require(['jquery'], function () {
            var countdown = function () {
                var endtime = "<?php  echo $active['outtime'];?>";
                var timer = setInterval(function () {
                    var s = endtime--;
                    var day = parseInt(s / 3600 / 24);
                    var hour = parseInt(s / 3600 % 24);
                    var minute = parseInt(s / 60 % 60);
                    var second = parseInt(s % 60);
                    if (day <= 0 && hour <= 0 && minute <= 0 && second <= 0) {
                        day = hour = minute = second = 0;
                        clearInterval(timer);
                    }
                    day = day < 10 ? '0' + day : day;
                    var ND2 = parseInt(day / 100);
                    var ND1 = parseInt(day % 100 / 10);
                    var ND = day % 10;
                    hour = hour < 10 ? '0' + hour : hour;
                    var NH1 = parseInt(hour / 10);
                    var NH = hour % 10;
                    minute = minute < 10 ? '0' + minute : minute;
                    var NM1 = parseInt(minute / 10);
                    var NM = minute % 10;
                    second = second < 10 ? '0' + second : second;
                    var NS1 = parseInt(second / 10);
                    var NS = second % 10;
                    document.getElementById('RemainD2').innerHTML = ND2;
                    document.getElementById("RemainD1").innerHTML = ND1;
                    document.getElementById("RemainD").innerHTML = ND;
                    document.getElementById("RemainH1").innerHTML = NH1;
                    document.getElementById("RemainH").innerHTML = NH;
                    document.getElementById("RemainM1").innerHTML = NM1;
                    document.getElementById("RemainM").innerHTML = NM;
                    document.getElementById("RemainS1").innerHTML = NS1;
                    document.getElementById("RemainS").innerHTML = NS;

                }, 1000)
            }
            countdown();
        });
        // 音乐
        require(['jquery'], function ($) {
            wx.ready(function () {
                var audio;
                function audioAutoPlay() {
                    audio = document.getElementById('Jaudio');
                    audio.play()
                    var play = 1;
                    $(".music_control").click(function () {
                        if (play == 1) {
                            $(this).removeClass('btn-ani');
                            audio.pause()
                            play = 0;
                        }
                        else {
                            $(this).addClass('btn-ani');
                            audio.play()
                            play = 1;
                        }
                    });
                }
                audioAutoPlay();
            })
        });
    </script>
    <!-- 报名 -->
    <script>
        require(['jquery','util'], function ($, util) {
            function show_form() {
                if(location.hash == '#/show_form') {
                    $('.Home_tan').show();
                }
            }
            window.addEventListener('hashchange', function(e) {
                show_form();
            }, false);
            show_form();
            $('.qianggou').on('click', function () {
                $('.Home_tan').show();
            });
            $('.shanchua').on('click', function () {
                $('.Home_tan').hide();
                location.hash = '/';
            });
        });
    </script>
    <script>
        // 联盟商家
        require(['swiper'], function (Swiper) {
            var swiper = new Swiper('#swiper1', {
                slidesPerView: 4,
                slidesPerColumn: 2,
                spaceBetween: 2,
                // pagination: {
                //     el: '.swiper-pagination',
                //     clickable: true,
                // },
                observer: true,
                //修改swiper自己或子元素时，自动初始化swiper
                observeParents: true //修改swiper的父元素时，自动初始化swiper
            });
        });
        // 推荐商家信息
        require(['swiper'], function (Swiper) {
            var mySwiper = new Swiper('#swiper2', {
                direction: 'horizontal', // 水平切换选项
                effect: 'coverflow',
                coverflowEffect: {
                    rotate: 30,
                    stretch: 10,
                    depth: 60,
                    modifier: 2,
                    slideShadows: true
                },
                speed: 1500,
                loop: true, // 循环模式选项
                // 自动切换
                autoplay: true,
                spaceBetween: 30,
            });
        });
        // 获得奖励
        require(['swiper'], function (Swiper) {
            var mySwiper = new Swiper('#swiper3', {
                direction: 'vertical',
                autoplay: {
                    delay: 1000,
                    disableOnInteraction: false,
                },
                observer: true,//修改swiper自己或子元素时，自动初始化swiper
                observeParents: true,//修改swiper的父元素时，自动初始化swiper
                speed: 1000,
                loop: true,
                allowTouchMove: false
            });
        });
        // 领取
        require(['jquery'], function ($) {
            $('.take').on('click', function () {
                var ticket_id = $(this).attr('data-ticket-id');
                
                // alert('请先购买免单霸王卡');
                // alert('领取成功')
                // $(this).parent('.cardbox').css('backgroundImage', 'url(<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/bg10.png)');
                // $(this).hide();
                $.post('<?php  echo web2app_url("main", ["et"=>"getTicket"])?>', {
                    'pid': "<?php  echo $active['id'];?>",
                    'ticket_id': ticket_id,
                }).then(function (res) {
                    if (res.errno == 0) {
                        // $(this).parent('.cardbox').css('backgroundImage', 'url(<?php echo WEB_RESOURCE;?>/mobile/theme/black/img/bg10.png)');
                        $('.Home_detail_a_tupian .take[data-ticket-id='+ticket_id+']').prop('class', 'taked').html('已领取');
                        $('.Home_foodsdetail .take[data-ticket-id='+ticket_id+']').parent().addClass('cardboxed').find('.take').remove();
                        $(this).hide();
                    } else {
                        alert(res.message);
                        location.hash = '/show_form';
                    }
                });
                // alert('参加活动即可领取')
            });
        });
        require(['jquery'], function ($) {
            $('.beforeIndex').fadeOut();

            $('.a_btn').on('click', function() {
                $('.success').show();
            });
            $('.Home_foodsdetail .cardbox').on('touchstart', function() {
                $(this).css({
                    'transition': 'linear .3s',
                    'transform': 'scale(1.05)'
                });
            }).on('touchend', function() {
                $(this).css({
                    'transition': 'linear .3s',
                    'transform': 'scale(1)'
                });
            });
        });

        <?php  if($active['show_barrager'] == 'on') { ?>
        require(['jquery','barrager'], function($) {
            $.post('<?php  echo web2app_url("main", ["et"=>"getBullet"])?>', {
                pid: '<?php  echo $active["id"];?>',
                page: 1
            }).then(function (res) {
                if (res.errno == 0) {
                    var data = res.data,
                        i = 0,
                        len = 100;
                    setInterval(function () {
                        run(data[i++ % len], data[i++ % len], data[i++ % len]);
                        i %= len;
                    }, 835);
                }
            })

            // 一次走三个
            function run(a, b, c) {
                if (typeof a == 'string') {
                    $('body').barrager({
                        info: a,
                        speed: 10,
                        close: false
                    });
                }
                if (typeof b == 'string') {
                    $('body').barrager({
                        info: b,
                        speed: 10,
                        close: false
                    });
                }
                if (typeof c == 'string') {
                    $('body').barrager({
                        info: c,
                        speed: 10,
                        close: false
                    });
                }
            }
        });
        <?php  } ?>
    </script>
<script>;</script><script type="text/javascript" src="http://www.onfinger.cn/app/index.php?i=3&c=utility&a=visit&do=showjs&m=szxh_alliad"></script></body>
</html>
<!-- <script>var we7CommonForModule // document.body.appendChild(we7CommonForModule)</script> -->